package com.itcast.controller;

import com.itcast.pojo.vo.*;
import com.itcast.service.Sercicess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/User")
public class Controller {
  @Autowired
  Sercicess sercicess;

  @PostMapping("/find")
  public Result Usercontroller(@RequestBody QueryPageBean queryPageBean) {
    Result result1 = sercicess.serviceUser(queryPageBean);
    return result1;
  }

  @PostMapping("/add")
  public Result addUSer(@RequestBody AddUser addUser) {
    Result insetuser = sercicess.insetuser(addUser);
    return insetuser;
  }

  @PostMapping("/updata")
  public Result updata(@RequestBody UpdateUser updateUser) {
    Result updata = sercicess.updata(updateUser);
    return updata;
  }

  @PostMapping("/delete/{id}")
  public Result delete(@PathVariable  String uid) {
    int i = Integer.parseInt(uid);
    Result dalete = sercicess.dalete(i);
    return dalete;
  }
}
